#include "Telephone.h"

Telephone::Telephone(void)
{
	// mac dinh cac truong cua record khi create
	name = "";
	name_orient = 0;
	sizes = "";
	radio = false;
	card = false;
	net = false;
	haveprice = false;
	other = "";
	first = false;
	price = 1000;
	camera = 1;
	id = -1;
}

Telephone::~Telephone(void)
{
}

bool Telephone::operator == (const Telephone &other)
{
	bool isEqual = true;
	isEqual = this->name == other.name;
	isEqual &= this->name_orient == other.name_orient;
	isEqual &= this->sizes == other.sizes;
	isEqual &= this->radio == other.radio;
	isEqual &= this->card == other.card;
	isEqual &= this->net == other.net;
	isEqual &= this->haveprice == other.haveprice;
	isEqual &= this->other == other.other;
	isEqual &= this->first == other.first;
	isEqual &= this->price == other.price;
	isEqual &= this->camera == other.camera;
	return isEqual;
}
bool Telephone::operator > (const Telephone &other)
{
	if (name > other.name)
	{
		return true;
	}
	else if(name == other.name)
	{
		if (name_orient > other.name_orient)
		{
			return true;
		}
		else if (name_orient == other.name_orient && price > other.price)
		{
			return true;
		}
		return false;
	}
	return false;
}
// viet mot ham tra ve mot struct 
//PhoneItem Telephone::toItem()
//{
//	PhoneItem phone;
//	phone.name = name;
//	phone.name_orient = name_orient;
//	phone.price = price;
//	phone.id = id;
//
//	return phone;
//}
PhoneItem Telephone::toItem()
{
	PhoneItem phone;
	phone.name = name;
	phone.name_orient = name_orient;
	phone.price = price;
	phone.id = id;

	return phone;
}